/*
 *   Copyright (C) 2010  Jens Kieselbach
 * 
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 * 
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 * 
 *   You may obtain a copy of the License at http://www.gnu.org/licenses/gpl.html
 */

package de.kieselbach.grootional.value

import de.kieselbach.grootional.util.*

class TableColumnValue {

    def primaryKey
    def foreignKey
    def name
    def jdbcType
    def type
    def size
    def decimalDigits
    def notNull

    TableColumnValue(def pk, def fk, def na, def jd, def ty, def si, def de, def nn) {

        primaryKey = pk
        foreignKey = fk
        name = na
        jdbcType = jd
        type = ty
        size = si
        decimalDigits = de
        notNull = nn
    }

    def getAt(int i) {

        switch(i) {
            case 0:
                return primaryKey
            case 1:
                return foreignKey
            case 2:
                return name
            case 3:
                return jdbcType
            case 4:
                return type
            case 5:
                return size
            case 6:
                return decimalDigits
            case 7:
                return notNull
            default:
                throw new NoSuchElementException()
        }
    }


    void setAt(int i, def val) {

        switch(i) {
            case 0:
                primaryKey = val
            case 1:
                foreignKey = val
            case 2:
                name = val
            case 3:
                jdbcType = val
            case 4:
                type = val
            case 5:
                size = val
            case 6:
                decimalDigits = val
            case 7:
                notNull = val
            default:
                throw new NoSuchElementException()
        }
    }
}

